<?php

namespace api\controllers;

use common\core\behaviors\Permission;
use common\core\controller\RestController;
use common\core\filter\CompositeAuth;
use common\core\filter\HttpHeaderAuth;
use common\core\filter\QueryParamAuth;

class Controller extends RestController
{

    public function behaviors()
    {
        $behaviors = parent::behaviors();
        $behaviors['authenticator'] = [
            'class' => CompositeAuth::class,
            'authMethods' => [
                HttpHeaderAuth::class,
                QueryParamAuth::class,
            ],
        ];
        $behaviors['permission'] = [
            'class' => Permission::class,
            'isValidate' =>  YII_ENV_PROD, //YII_ENV_DEV
        ];
        return $behaviors;
    }
}
